<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>

<form name="form1" id="form1" action="" method="post">
	<div class="pageMain">
		<div class="pageTitle"><%=MessageResourcesUtils.getMessage(request, "systemmanage.bascmanagement.title") %><span></span><%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.title") %><span></span><%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityUpdate.title") %></div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.openbankcitycode") %></label>
						<span><input type="text" id="citycode" name="citycode" value="${city.citycode }" class="validate[required,maxSize[10],custom[onlyLetterNumber]]"/></span>
					</li>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.openbankcityname") %></label>
						<span><input type="text" id="cityname" name="cityname" value="${city.cityname }" class="validate[required,maxSize[20]]" /></td></span>
					</li>
				</ul>	
				<ul>
					<li>
						<i>*</i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.city.cityList.provincename") %></label>
						<span>
							<input type="text" id="provincename" name="provincename" value="${city.provincename}" class="validate[required,maxSize[20]]">
							<input type="hidden" id="provinceid" name="provinceid" value="${city.provinceid}">
						</span>
					</li>
				</ul>
       		</div>
       		<div class="button-group">
       			<input type="hidden" name="id" value="${city.id }"/>
       			<input type="button" class="btn btn-default"  id="butSave" name="butSave" value='<%=MessageResourcesUtils.getMessage(request, "common.button.save") %>' />
       			<input type="button" class="btn btn-default"  id="butReturn" name="butReturn" value='<%=MessageResourcesUtils.getMessage(request, "common.button.back") %>' />
			</div>
		</div>
	</div>
</form>

<script type="text/javascript">	
$(document).ready(function() {
	$("#provincename").issNewMagnifier({
		title: '<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.openbankprovincelist") %>',
		url: '${systemctx}/publicMagnifier/publicMagnifier.json',
		sortName : 'modifytime',
		sortOrder : 'desc',
		linkName: 'name',
		callSqlKey: 'queryProvinceMagnifierSql',
		columns:[[
					{title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.openbankprovincecode")%>',field:'code',width:180,sortable:true,search:true,align:'left',},
					{title:'<%=MessageResourcesUtils.getMessage(request, "systemmanage.province.provinceList.openbankprovincename")%>',field:'name',width:300,search:true,sortable:true,align:'left',to:'provincename'},
					{field:'id',hidden:true,formel:'provinceid'}
				]],
		onBeforeOpen:function(p){
	      var queryParams = {
	    		  queryprovincename: '%'+ $('#provincename').val() +'%',
	    		  statusid: <%=SysConstant.RecordStatus.VALID %>
	      };
	      return queryParams; 
	    }
	});
	
	
	$('#butSave').click(function() {
			var exp = $('#form1').validationEngine('validate');

			if(exp==true)
			{
					// 显示进度条
					showSending();
					$.ajax({
						type: 'POST',
					    url: '${systemctx}/systemmanage/city/validattionCity.json',
					    data: $("#form1").serialize(),
					    dataType: 'json',
					    success: function(data)
					    {
					    	//关闭执行...
							closeSending();
					    	if (data.messagetype == '2')
					    	{
					    		//显示AJAX请求后的提示信息
								$.fn.ajaxmessage(data);
					    	}
					    	else
					    	{
					    		form1.action="${systemctx}/systemmanage/city/updateCity.web";
								form1.submit();
					    	}
					    }
					});
			}
	});
	
	$('#butReturn').click(function(){
		parent.document.location.reload();
	    $.fn.closeIssWindow();
	});
	
});
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>